/**
 * @author rxliuli
 */
const sysBackupLogApi = new class SysBackupLogApi extends BaseApi {
    constructor() {
        super('/api/sysBackupLog')
    }

    async initSettings() {
        return (await rxajax.post(this.using('/init-settings'))).data
    }

    async updateSettings(dataBackupSetting, offSiteBackupSetting) {
        return (await rxajax.post(this.using('/update-settings'), {...dataBackupSetting, ...offSiteBackupSetting})).data
    }

    async getSettings() {
        return (await rxajax.get(this.using('/get-settings'))).data.data
    }

    async manualBackup(settings) {
        return (await rxajax.post(this.using('/manual-backup'), settings, {
            timeout: 1000 * 60 * 60 * 2,
        })).data
    }

    async deleteBackup(id) {
        return (await rxajax.post(this.using(`/delete-backup/${id}`))).data
    }

    async restore(id) {
        return (await rxajax.post(this.using(`/restore/${id}`))).data
    }
}()